<?php /*a:1:{s:60:"D:\web\www\tp5.1\public/../app/admin\view\welfare_m\add.html";i:1526302509;}*/ ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/frame/layui/css/layui.css">
    <link rel="stylesheet" href="/static/frame/static/css/style.css">
    <link rel="icon" href="/static/frame/static/image/code.png">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body class="body">

<form class="layui-form" action="" method="post" id="addform">
  <div class="layui-form-item">
    <label class="layui-form-label">角色</label>
    <div class="layui-input-inline">
      <input type="text" name="name" lay-verify="name" autocomplete="off" placeholder="角色昵称" class="layui-input">
    </div>
    <label class="layui-form-label"><i class="layui-icon layui-icon-circle"></i></label>
  </div>

	<div class="layui-form-item">
        <label class="layui-form-label">福利类型</label>
        <div class="layui-input-inline">
            <select name="type" lay-verify="required" lay-search="">
                <?php foreach($type as $key=>$vo): ?>
            	<option value="<?php echo htmlentities($vo['id']); ?>"><?php echo $vo['name']; ?></option>
                <?php endforeach; ?>
            </select>
        </div>
	</div>
    <div class="layui-form-item">
        <label class="layui-form-label">发放数量</label>
        <div class="layui-input-block">
            <input type="number" name="num" class="layui-input" min="1">
        </div>
    </div>

      <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <input type="remark" name="keywords" class="layui-input">
        </div>
    </div>

  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
 

          
<script src="/static/frame/layui/layui.js" charset="utf-8"></script>
<script src="/static/admin/js/comm.js" charset="utf-8"></script>
<script>
    layui.use(['jquery', 'form', 'upload', 'laydate', 'layedit', 'laydate','admin'], function() {
      var form = layui.form,
        layer = layui.layer,
        upload = layui.upload,
        $ = layui.$, //重点处
        layedit = layui.layedit,
        laydate = layui.laydate,
        admin = layui.admin;

      //自定义验证规则
      form.verify({
        name: function(value) {
          if (value.length < 2) {
            return '标题至少得2个字符啊';
          }
        }
      });

//添加
    $('#addauth').click(function(){
      layer.open({
        title: "发放福利",
        type: 2,
        area: ['450px', '500px'],
        fixed: false, //不固定
        maxmin: true,
        content: "/admin/game_center/addupdate.html?id=1"
      });
    });


      //创建一个编辑器

      //监听指定开关
      // form.on('submit(demo1)', function(data) {
      //   $.post('<?php echo url('add'); ?>', $('#addform').serialize(),
      //     function(data) {
      //       if (data.code == 1) {
      //         layer.alert(data.msg, {
      //           skin: 'layui-layer-molv' //样式类名
      //             ,
      //           closeBtn: 0
      //         }, function() {
      //           location.href = data.url;
      //         });
      //       } else {
      //         layer.msg(data.msg);
      //       }
      //     });
      //   return false;
      // });

        form.on('submit(demo1)', function(data){
            admin.action("<?php echo url('admin/WelfareM/add'); ?>",$("#addform").serialize());
            return false;
        });



    });
</script>

</body>
</html>